package game;

import game.communication.Communication;

import java.util.Date;

public class Message implements Comparable<Message> {
	private Person sender;
	private Person receiver;
	private Communication communication;
	private Date time;
	private boolean isRead;

	public Message(Person sender, Person receiver, Communication communication,
			Date time) {
		this.sender = sender;
		this.receiver = receiver;
		this.communication = communication;
		this.time = time;
		this.isRead = false;
	}

	public void read() {
		this.isRead = true;
	}

	public boolean getIsRead() {
		return this.isRead;
	}

	public Communication getCommunication() {
		return communication;
	}

	public Date getTime() {
		return time;
	}

	@Override
	public int compareTo(Message o) {
		return time.compareTo(o.getTime());
	}

	public Person getSender() {
		return this.sender;
	}

	public Person getReceiver() {
		return this.receiver;
	}

	@Override
	public String toString() {
		return "Message[" + this.communication.getText() + "]";
	}
}
